<?php
	class registeredloginModel extends Model{
		public function registeredloginAction(){
                  $username = $_POST["username"];
                  $pwd = $_POST["pwd"];
                  $sex = $_POST["sex"];
                  $sql = "select * from user where email={$username}";

                  $str = $this->link->selectDB($sql);

                  if($str){
                        echo json_encode(['code'=>201,'msg'=>'账号已存在']);
                  }else{
                        $query="insert into user(username,pwd,email,sex,avatar,status)values('{$username}','{$pwd}','{$username}','{$sex}','https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=8232468,2916696848&fm=27&gp=0.jpg','0')";
                        $row = $this->link->query($query);
                        echo json_encode($row);
                  }

            
		}
	}
	
?>